home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / bin / nethack < prev    next >
Text File  |  1995-07-30  |  1KB  |  71 lines

  1. #!/bin/sh
  2. #    SCCS Id: @(#)nethack.sh    3.1    90/02/26
  3.  
  4. GAMEDIR=/usr/skunk/games/lib
  5. FONTDIR=/usr/games/lib/nethackdir/fonts
  6. HACKDIR=/usr/games/lib/nethackdir
  7. HACK=$GAMEDIR/nethack
  8. MAXNROFPLAYERS=4
  9. NETHACKOPTIONS=$HACKDIR/nethack.rc
  10. export NETHACKOPTIONS
  11.  
  12. # see if we can find the full path name of PAGER, so help files work properly
  13. # assume that if someone sets up a special variable (HACKPAGER) for NetHack,
  14. # it will already be in a form acceptable to NetHack
  15. # ideas from brian@radio.astro.utoronto.ca
  16. if test \( "xxx$PAGER" != xxx \) -a \( "xxx$HACKPAGER" = xxx \)
  17. then
  18.  
  19.     HACKPAGER=$PAGER
  20.  
  21. #    use only the first word of the pager variable
  22. #    this prevents problems when looking for file names with trailing
  23. #    options, but also makes the options unavailable for later use from
  24. #    NetHack
  25.     for i in $HACKPAGER
  26.     do
  27.         HACKPAGER=$i
  28.         break
  29.     done
  30.  
  31.     if test ! -f $HACKPAGER
  32.     then
  33.         IFS=:
  34.         for i in $PATH
  35.         do
  36.             if test -f $i/$HACKPAGER
  37.             then
  38.                 HACKPAGER=$i/$HACKPAGER
  39.                 export HACKPAGER
  40.                 break
  41.             fi
  42.         done
  43.         IFS='     '
  44.     fi
  45.     if test ! -f $HACKPAGER
  46.     then
  47.         echo Cannot find $PAGER -- unsetting PAGER.
  48.         unset HACKPAGER
  49.         unset PAGER
  50.     fi
  51. fi
  52.  
  53.  
  54. if [ "$DISPLAY" ]
  55. then
  56.     xset +fp $FONTDIR
  57. else
  58.     NETHACKOPTIONS=windowtype:tty
  59.     export NETHACKOPTIONS
  60. fi
  61. cd $HACKDIR
  62. case $1 in
  63.     -s*)
  64.         exec $HACK "$@"
  65.         ;;
  66.     *)
  67.         exec $HACK "$@" $MAXNROFPLAYERS
  68.         ;;
  69. esac
  70. [ "$DISPLAY" ] && xset -fp $FONTDIR
  71.